import { TransformInterceptor } from './core/interceptor/transform.interceptor';
import { ConfigService } from '@nestjs/config';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { Logger } from '@nestjs/common';
import { setupSwagger } from './core/swagger';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.useGlobalInterceptors(new TransformInterceptor());
  const configService = app.get(ConfigService);
  setupSwagger(app);
  Logger.log(`server start port ${configService.get('port')}`, 'startPort')
  await app.listen(Number(configService.get('port')));
  Logger.log(configService.get('port'), 'port');
}
bootstrap();
